package com.example.index.web;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

//  消息生产方
@RestController
public class MQProduceAction {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("simpleMessage")
    public String simpleMessage(String data){
        String queue = "simpleQueue";
        rabbitTemplate.convertAndSend(queue, data);
        return "简单消息发送完成: " + data;
    }


}
